{include file="$temps.head" title="$webs.title" keywords="$webs.keywords" description="$webs.description" /}
<form class="layui-form" action="{:url('gouwuche')}" method="post">
<ul class="layout fex-column">
    <li id="addresbtn" class="pad-a10 b-b bg-fff mb-10 addrestext cx-fex">
        {present name="order.conf.addres"}
        <div class="x11 fex-column">
            <div class="layout cx-fex">
                <span>收货人：{$order.conf.adduname}</span>
                <span>手机：{$order.conf.phone}</span>
            </div>
            <div class="layout">地址：{$order.conf.addres}</div>
        </div>
        <div class="x1 cx-fex-c fex-items-c">
            <i class="cx-icon cx-icon-fanhui-copy-copy"></i>
        </div>
        {else /}
        <span>请选择地址</span>
        <i class="cx-icon cx-icon-fanhui-copy-copy"></i>
        {/present}
    </li>
    {volist name="order.conf.shop" id="cx" empty="" key="k"}
    <li class="layout cx-fex-l bg-fff or-tuanshop">
        <a class="layout cx-fex-l" href="{:url('Article/index',array('aid'=>$cx.aid))}">
        <div class="xl3">
            <div class="or-tuan-img">
                <img class="img-responsive" src="{$cx.picurl}" alt="{$cx.title}" >
            </div>
        </div>
        <div class="xl9 pad-l10 cx-fex fex-column">
            <h3 class="or-title">{$cx.title}</h3>
            <div class="layout cx-fex">
               <div class="t-gray">数量:{$cx.num}</div>
               <div class="t-gray t-14">
                    <i class="cx-icon cx-icon-renminbi1688 t-red"></i>
                    <span class="t-red t-16">
                      {$cx['pricemoney'] * $cx['num']}
                   </span>
               </div>
            </div>
        </div>
        </a>
    </li>
    {/volist}
    <li class="layout fex-column bg-fff or-tuanshop mt-10">
        <h4 class="t-gray">订单留言</h4>
        <textarea class="ipt" name="message">{$order.conf.message|default=""}</textarea>
    </li>
</ul>

    <input class="addresval" type="hidden" name="addres" value="{$order.conf.addres|default=''}">
    <input class="zoneidval" type="hidden" name="zoneid" value="{$order.conf.zoneid|default=''}">
    <input class="phoneval" type="hidden" name="phone" value="{$order.conf.phone|default=''}">
    <input class="postalval" type="hidden" name="postal" value="{$order.conf.postal|default=''}">
    <input class="addunameval" type="hidden" name="adduname" value="{$order.conf.adduname|default=''}">
    <input type="hidden" name="oid" value="{$order.oid}">
    <input class="zoneidval" type="hidden" name="foid" value="{$Request.param.oid}">
    <div class="layout or-playk pos-f bg-fff cx-fex">
        <div class="t-gray t-14 pad-l10">
            <span class="mr-10">共支付：</span>
            <i class="cx-icon cx-icon-renminbi1688 t-red"></i>
            <span class="t-red t-18">
                {$order['pricemoney'] / 100}
            </span>
        </div>
        <div>
            <button class="button bg-red" lay-submit lay-filter="button">立即支付</button>
        </div>
    </div>
</form>
<script>
    wx.config({
        appId: '{$webdb.wxappid}', // 必填，公众号的唯一标识
        timestamp: '{$wxjsapi.timestamp}', // 必填，生成签名的时间戳
        nonceStr: '{$wxjsapi.noncestr}', // 必填，生成签名的随机串
        signature: '{$wxjsapi.sing}',// 必填，签名
        jsApiList: [
            'openAddress',
        ] // 必填，需要使用的JS接口列表
    });
    wx.ready(function(){
        {notpresent name='order.conf.addres'}
        wx.openAddress({
            success: function (res) {
                var seeuser = res.provinceName + " " + res.cityName + " " + res.countryName + " " + res.detailInfo + "," + res.postalCode;
                $(".addrestext").html("<div class='x11 fex-column'><div class='layout cx-fex'><span>收货人："+res.userName+"</span><span>手机："+res.telNumber+"</span></div><div class='layout'>地址："+seeuser+"</div></div><div class='x1 cx-fex-c fex-items-c'><i class='cx-icon cx-icon-fanhui-copy-copy'></i></div>");
                $(".addresval").val(seeuser);
                $(".postalval").val(res.postalCode);
                $(".zoneidval").val(res.nationalCode);
                $(".addunameval").val(res.userName);
                $(".phoneval").val(res.telNumber);
            }
        });
        {/notpresent}
        document.querySelector('#addresbtn').onclick = function () {
            wx.openAddress({
                success: function (res) {
                    var seeuser = res.provinceName + " " + res.cityName + " " + res.countryName + " " + res.detailInfo + "," + res.postalCode;
                    $(".addrestext").html("<div class='x11 fex-column'><div class='layout cx-fex'><span>收货人："+res.userName+"</span><span>手机："+res.telNumber+"</span></div><div class='layout'>地址："+seeuser+"</div></div><div class='x1 cx-fex-c fex-items-c'><i class='cx-icon cx-icon-fanhui-copy-copy'></i></div>");
                    $(".addresval").val(seeuser);
                    $(".postalval").val(res.postalCode);
                    $(".zoneidval").val(res.nationalCode);
                    $(".addunameval").val(res.userName);
                    $(".phoneval").val(res.telNumber);
                }
            });
        };
    });
    wx.checkJsApi({
        jsApiList: ['onMenuShareAppMessage'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
        success: function(res) {

        }
    });
</script>
{include file="$temps.foot" /}